# test01_email.py
import smtplib
from email.mime.text import MIMEText
from email.header import Header

def email(body, sender, receiver, title):
    msg = MIMEText(body, "plain", "utf8")
    msg["From"] = Header(sender, "utf8")
    msg["To"] = Header(str(receiver), "utf8")
    msg["Subject"] = Header(title, "utf8")
    smtp = smtplib.SMTP("127.0.0.1")
    smtp.sendmail(
        sender, receiver ,msg.as_bytes())
if __name__ == '__main__':
    email("test", "root", ["bob","alice"], "py")
    print("ok~")
